Trò chơi đua xe động vật trong UNITY Engine
114.854 lượt xem;
- Buttons.cs
- MainMenu /
- AnimalRacing /
- Scripts /
- Assets /
- project /
1 using UnityEngine;
2 using System.Collections.Generic;
3
4 namespace MainMenu
5 {
6
7 public class Buttons : MonoBehaviour
8 {
9
10 public List<GameObject> buttons;
11
12 public void Start()
13 {
14 float[] btX = new float[] { 3.3f, 3.55f};
15 for (int i = 0; i < buttons.Count; i++)
16 {
17 buttons[i].GetComponent<Actor>().addAction(new ActionMoveTo(btX[i], buttons[i].gameObject.transform.localPosition.y, 0.8f + 0.2f * i, Interpolation.swingOut));
18 if (i == 0)
19 {
20 buttons[i].GetComponent<Actor>().addAction(new ActionRepeat(ActionRepeat.FOREVER, new ActionSequence(new ActionScaleTo(0.9f, 0.9f, 0.1f), new ActionScaleTo(1, 1, 0.1f))));
21 }
22 }
23 }
24
25
26 }
27 }
2 using System.Collections.Generic;
3
4 namespace MainMenu
5 {
6
7 public class Buttons : MonoBehaviour
8 {
9
10 public List<GameObject> buttons;
11
12 public void Start()
13 {
14 float[] btX = new float[] { 3.3f, 3.55f};
15 for (int i = 0; i < buttons.Count; i++)
16 {
17 buttons[i].GetComponent<Actor>().addAction(new ActionMoveTo(btX[i], buttons[i].gameObject.transform.localPosition.y, 0.8f + 0.2f * i, Interpolation.swingOut));
18 if (i == 0)
19 {
20 buttons[i].GetComponent<Actor>().addAction(new ActionRepeat(ActionRepeat.FOREVER, new ActionSequence(new ActionScaleTo(0.9f, 0.9f, 0.1f), new ActionScaleTo(1, 1, 0.1f))));
21 }
22 }
23 }
24
25
26 }
27 }